home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Business Master (3rd Edition)
/
The Business Master (3rd Edition).iso
/
files
/
wordmisc
/
banner
/
fontsy.bas
< prev
next >
Wrap
BASIC Source File
|
1986-09-06
|
11KB
|
474 lines
'FONTSY.BAS version 2.1 (C) Copyright 1985, 1986 by Merlin R. Null
'MS-DOS version. 9/6/86 Requires QuickBASIC v. 2.0, (C) Microsoft,
'to compile, and must be linked with the assembly language routines in
'FSY.ASM. Banner printing program. Requires external fonts encoded with
'FONTCODE. This program may not be sold separately or as part of any
'collection of programs or used as an inducement to buy any other
'product or program without the written permission of the author:
'Merlin R. Null, P.O. Box 9422, N. Hollywood, CA 91609, (818) 762-1429
DEFINT A-Z
DIM FontChar$(95)
ON ERROR GOTO ErrorTrap
WIDTH LPRINT 255
COLOR 11,0
IF LEN(COMMAND$)>0 THEN
Font$=COMMAND$
CALL DoTitle
ELSE
FontScreen: 'enter font screen
CALL DoTitle
CALL FontScr
IF ErrorMes$<>"" THEN
LOCATE 22,40-(LEN(ErrorMes$)/2)
COLOR 12,0
PRINT ErrorMes$;
COLOR 11,0
ErrorMes$=""
BEEP
END IF
EnterFont: 'here after directory call
CALL FontPrompt
LOCATE 24,28,1
LINE INPUT;Font$
IF Font$="" THEN
GOTO FontScreen
END IF
FontLen$=""
IF RIGHT$(Font$,1)=":" OR RIGHT$(Font$,1)="\" THEN
CLS
Dir$=Font$+"*.FNT"
LOCATE 1,20
400 FILES Dir$
LOCATE 1,1
PRINT"Available fonts on ";
GOTO EnterFont
END IF
END IF
IF INSTR(Font$,".")=0 THEN
Font$=Font$+".FNT"
END IF
500 OPEN Font$ FOR INPUT AS 1 'load font
CALL LoadingFont
LINE INPUT #1,Title$
LINE INPUT #1,Comment$
LINE INPUT #1,PrnChar$
LINE INPUT #1,MARGIN$
Margin=VAL(Margin$)
LINE INPUT #1,Spacing$
Spacing=VAL(Spacing$)
FOR J=1 TO 95
LINE INPUT #1,FontChar$(J)
IF J=1 AND FontChar$(J)<>"" THEN
FontLen$="space "
ELSEIF FontChar$(J)<>"" THEN
FontLen$=FontLen$+CHR$(J+31)+" "
END IF
IF EOF(1) THEN
CLOSE
GOTO Main
END IF
NEXT
LINE INPUT #1,Init$
LINE INPUT #1,Reset$
INPUT #1,HzMult
INPUT #1,VMult
INPUT #1,Vdiv
CLOSE
IF HzMult=2 THEN
HzWdth$="Double"
HColor=12
ELSEIF HzMult=3 THEN
HzWdth$="Triple"
HColor=13
ELSE
HzWdth$="Single"
HzMult=1
HColor=11
END IF
IF VMult=2 THEN
VWdth$="Double"
VColor=12
ELSEIF VMult=3 THEN
VWdth$="Triple
VColor=13
ELSEIF VDiv=2 THEN
VWdth$="Half "
VColor=14
ELSE
VWdth$="Single"
VMult=1
VDiv=1
VColor=11
END IF
Main: 'banner text screen
CALL DoTitle
CALL GetBanner
LOCATE 6,1
PRINT TAB(39-(LEN(Title$)/2)) Title$
PRINT TAB(39-(LEN(Comment$)/2)) Comment$
LOCATE 12,1
FOR I=1 TO 133 STEP 66
IF LEN(FontLen$)>I THEN
PRINT TAB(7) MID$(FontLen$,I,65)
END IF
NEXT
LOCATE 23,15,1
LINE INPUT Txt$
IF Txt$="" THEN
OptionMenu: 'option menu screen
IF PrnChar$<CHR$(127) AND PrnChar$>" " THEN
PC$=" "+PrnChar$+" -"+STR$(ASC(PrnChar$))+" decimal"
ELSEIF PrnChar$=CHR$(255) THEN
PC$=" Variable"
ELSE
PC$=STR$(ASC(PrnChar$))+" decimal"
END IF
CALL OptionMenu
LOCATE 5,52
PRINT Font$;
LOCATE 7,52
PRINT"Column";Margin;
LOCATE 9,51
PRINT PC$;
LOCATE 11,51
PRINT Spacing;"rows";
LOCATE 13,52
COLOR HColor,0
PRINT HzWdth$;
LOCATE 15,52
COLOR VColor,0
PRINT VWdth$;
LOCATE 18,52
IF NotSaved THEN
LOCATE 19,52
COLOR 12,0
PRINT"Not Saved";
END IF
COLOR 11,0
LOCATE 24,22,1
GetOption:
Opt$=INPUT$(1)
Done=0
IF Opt$=CHR$(3) THEN
GOTO Finish
ELSEIF Opt$<" " THEN
GOTO Main
ELSEIF Opt$="1" THEN
GOTO FontScreen
ELSEIF Opt$="2" THEN 'set left margin
WHILE NOT Done
BadString=0
CALL OptionScr2
LOCATE 8,53
PRINT Margin;
LOCATE 23,36,1
LINE INPUT;Margin$
IF Margin$<>"" THEN
FOR I=1 TO LEN(Margin$)
Byte$=MID$(Margin$,I,1)
IF Byte$<"0" OR Byte$>"9" OR I>3 THEN
BEEP
BadString=-1
END IF
NEXT
IF NOT BadString THEN
Margin=VAL(Margin$)
IF Margin>230 THEN
BEEP
ELSE
NotSaved=-1
Done=-1
END IF
END IF
ELSE
Done=-1
END IF
WEND
ELSEIF Opt$="3" THEN 'set print character
WHILE NOT Done
BadChar=0
CALL OptionScr3
LOCATE 6,46,0
PRINT PC$;
LOCATE 24,30,1
LINE INPUT;NewPrnChar$
IF LEN(NewPrnChar$)>3 THEN
BEEP
ELSEIF LEN(NewPrnChar$)>1 THEN
FOR I=1 TO LEN(NewPrnChar$)
IF MID$(NewPrnChar$,I,1)<"0"_
OR MID$(NewPrnChar$,I,1)>"9" THEN
BEEP
BadChar=-1
END IF
NEXT
IF VAL(NewPrnChar$)<256 AND NOT BadChar THEN
PrnChar$=CHR$(VAL(NewPrnChar$))
Done=-1
NotSaved=-1
ELSE
BEEP
END IF
ELSEIF LEN(NewPrnChar$)=1 THEN
PrnChar$=NewPrnChar$
Done=-1
NotSaved=-1
ELSE
Done=-1
END IF
WEND
ELSEIF Opt$="4" THEN 'set rows between characters
WHILE NOT Done
CALL OptionScr4
LOCATE 9,45
PRINT Spacing
LOCATE 24,18,1
LINE INPUT;Spacing$
IF Spacing$="" THEN
Done=-1
ELSEIF LEN(Spacing$)<3 THEN
Spacing=VAL(Spacing$)
NotSaved=-1
Done=-1
ELSE
BEEP
END IF
WEND
ELSEIF Opt$="5" THEN 'toggle print width
IF HzMult=3 THEN
HzWdth$="Single"
HzMult=1
HColor=11
ELSEIF HzMult=1 THEN
HzWdth$="Double"
HzMult=2
HColor=12
ELSE
HzWdth$="Triple"
HzMult=3
HColor=13
END IF
LOCATE 13,52
COLOR HColor,0
PRINT HzWdth$
COLOR 11,0
LOCATE 24,22,1
GOTO GetOption
ELSEIF Opt$="6" THEN 'toggle print height
IF VDiv=2 THEN
VWdth$="Single"
VColor=11
Vdiv=1
ELSEIF VMult=1 THEN
VWdth$="Double"
VMult=2
VColor=12
ELSEIF VMult=2 THEN
VWdth$="Triple"
VMult=3
VColor=13
ELSE
VWdth$="Half "
VMult=1
VDiv=2
VColor=14
END IF
LOCATE 15,52
COLOR VColor,0
PRINT VWdth$
COLOR 11,0
LOCATE 24,22,1
GOTO GetOption
ELSEIF Opt$="7" THEN 'set printer initialization & reset strings
CALL OptionScr7
GOSUB InitSet
IF DEC$="999" THEN
Init$=""
NotSaved=-1
ELSEIF PRNINIT$<>"" THEN
Init$=PrnInit$
NotSaved=-1
END IF
CALL OptionScr7a
GOSUB InitSet
IF DEC$="999" THEN
Reset$=""
NotSaved=-1
ELSEIF PrnInit$<>"" THEN
Reset$=PrnInit$
NotSaved=-1
END IF
ELSEIF Opt$="8" THEN 'save changes to disk
CALL OptionScr8
FontBak$=LEFT$(Font$,INSTR(Font$,"."))+"BAK"
2100 OPEN FontBak$ FOR INPUT AS 1 'see if <fontname>.BAK exists
CLOSE #1 'close, if found, else error trap gets it
LOCATE 8,20
PRINT"Erasing ";FontBak$
KILL FontBak$
NewBakFile:
LOCATE 10,20
PRINT"Changing ";Font$;" to ";FontBak$
NAME Font$ AS FontBak$
LOCATE 12,20
PRINT"Writing ";Font$
OPEN Font$ FOR OUTPUT AS 1
PRINT #1,Title$
PRINT #1,Comment$
PRINT #1,PrnChar$
PRINT #1,Margin$
PRINT #1,Spacing$
FOR J=1 TO 95
PRINT #1,FontChar$(J)
NEXT
PRINT #1,Init$
PRINT #1,Reset$
PRINT #1,HzMult
PRINT #1,VMult
PRINT #1,Vdiv
CLOSE
NotSaved=0
ELSE
GOTO GetOption
END IF
GOTO OptionMenu
END IF
DoBanner:
PRINT"Sending ====> ";
LPRINT Init$ 'printer initialization string
FOR I=1 TO LEN(Txt$)
Char=ASC(MID$(Txt$,I,1))-31
IF FontChar$(Char)="" THEN 'no lower case in font?
IF Char>65 AND Char<92 THEN
CHAR=CHAR-32 'then use upper, if available
END IF
END IF
IF Char>0 THEN
PRINT MID$(Txt$,I,1);
IF PrnChar$=CHR$(255) THEN
PChar$=CHR$(31+Char)
ELSE
PChar$=PrnChar$
END IF
ArrLen=LEN(FontChar$(Char))
IF ArrLen>0 THEN
FOR Byte=1 TO ArrLen STEP 2
Quit$=INKEY$
IF Quit$=CHR$(27) OR Quit$=CHR$(3) THEN
LPRINT Reset$
GOTO Main
END IF
LineFlag=0
IF MID$(FontChar$(Char),Byte,1)=CHR$(255) THEN
FOR J=1 TO HzMult
LPRINT
NEXT
Byte=Byte-1
ELSE
Segment=Segment+1
Column=ASC(MID$(FontChar$(Char),Byte,1))+Margin-31
Length=ASC(MID$(FontChar$(Char),Byte+1,1))-32
IF Length>95 THEN
Length=Length-128
LineFlag=-1
END IF
LPRINT TAB((Column*VMult)/VDiv)_
STRING$((Length*VMult)/VDiv,PChar$);
IF LineFlag THEN
LPRINT
NumRows=NumRows+1
IF NumRows<HzMult THEN
Byte=Byte-(Segment*2)
ELSE
NumRows=0
END IF
Segment=0
END IF
END IF
NEXT
IF Spacing>0 THEN
LPRINT STRING$(Spacing,10);
END IF
END IF
END IF
NEXT
LPRINT Reset$ 'printer reset string
GOTO Main
Finish:
CLS
END
InitSet: 'enter printer initialization or reset strings
K=0
CALL OptionScr7b
PrnInit$=""
Dec$="0"
' define scroll window in assembly values
ULCorner=&H0E00 'row 14 col 0
LRCorner=&H174F 'row 23 col 79
WHILE Dec$<>"" AND Dec$<>"999"
BadVal=0
K=K+1
LOCATE 24,1
PRINT"Decimal value for byte #";K;": ";
LINE INPUT;Dec$
CALL WindowScroll (ULCorner,LRCorner)
IF LEN(Dec$)>3 THEN
BEEP
BadVal=-1
K=K-1
ELSEIF Dec$<>"" THEN
FOR J=1 TO LEN(Dec$)
IF MID$(Dec$,J,1)<"0" OR MID$(Dec$,J,1)>"9" THEN
BEEP
J=LEN(Dec$)
BadVal=-1
K=K-1
END IF
NEXT
IF Dec$="999" THEN
PrnInit$=""
ELSEIF VAL(Dec$)>255 THEN
BEEP
K=K-1
ELSEIF NOT BadVal THEN
PrnInit$=PrnInit$+CHR$(VAL(Dec$))
END IF
END IF
WEND
'a bare return retains the old string
RETURN
ErrorTrap:
CLOSE
IF ERR=53 AND ERL=2100 THEN
RESUME NewBakFile
END IF
IF ERR=53 AND ERL=500 THEN
ErrorMes$=Font$+" not found - try again"
ELSEIF ERR=76 AND ERL=500 THEN
ErrorMes$="Path"+" not found - try again"
ELSEIF ERR=53 AND ERL=400 THEN
ErrorMes$="No fonts found on "+Font$
ELSEIF ERR=64 OR ERR=52 THEN
ErrorMes$=CHR$(34)+Font$+CHR$(34)+_
" is a bad file name or drive - try again"
ELSE
ON ERROR GOTO 0
END IF
RESUME FontScreen